package com.wanglin.jetpacktest

import android.util.Log
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.OnLifecycleEvent

class MyObserver(private val lifecycle:Lifecycle):LifecycleObserver {
    @OnLifecycleEvent(Lifecycle.Event.ON_START)
    fun activityStart()
    {
        Log.d("MyObserver","activityStart")
        Log.d("MyObserver","currentState=${lifecycle.currentState}")

    }

    @OnLifecycleEvent(Lifecycle.Event.ON_STOP)
    fun activityStop()
    {
        Log.d("MyObserver","activityStop")
        Log.d("MyObserver","currentState=${lifecycle.currentState}")
    }
}